package web;

import java.util.List;

import vo.User;
import business.UserService;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.Preparable;

@SuppressWarnings("unchecked")
public class UserAction extends ActionSupport implements Preparable {
	private UserService service;

	private List<User> users;

	public String listUser() {
		users = service.getAllUsers();
		return Action.SUCCESS;
	}

	public String addUser() {
		service.addUser("hello xxx");
		return listUser();
	}

	public List<User> getUsers() {
		return users;
	}

	public void prepare() throws Exception {
	}

	public void setUserService(UserService service) {
		this.service = service;
	}

	public void setService(UserService service) {
		this.service = service;
	}

		public void setUsers(List<User> users) {
		this.users = users;
	}


}